package com.relational.mapping.Service.Impl;

import com.relational.mapping.Model.Student;
import com.relational.mapping.Repository.StudentRepository;
import com.relational.mapping.Service.StudnetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Csea
 * @title
 * @date 2019/6/11 9:00
 */
@Service
public class StudentServiceImpl implements StudnetService {
    @Autowired
    private StudentRepository repository;
    @Override
    public Student save(Student student) {
        return repository.save(student);
    }

    @Override
    public Student findById(Integer studentId) {
        return repository.findById(studentId).orElse(null);
    }

    @Override
    public void deleteById(Integer studentId) {
        repository.deleteById(studentId);
    }
}
